package eg3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Scope
@Component
public class ShopController {
    private String shopName;

    public ShopController() {
        System.out.println("无参构造");
    }

    @Value("bread")
    public void setShopName(String shopName) {
        this.shopName = shopName;
        System.out.println("set method");
    }

    @PostConstruct
    public void init()
    {
        System.out.println("初始化阶段");
    }

    @PreDestroy
    public void destroy()
    {
        System.out.println("销毁阶段");
    }
}
